﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using famails.iface;
using famails.dao;
using famails.App_Code.source.dto;

namespace famails.bus
{
    /// <summary>
    /// Summary description for ArticleBUS
    /// </summary>
    public class CM_OrderBUS : ICM_Order
    {
        CM_OrderDAO cateDao;
        public CM_OrderBUS()
        {
            cateDao = new CM_OrderDAO();
        }

        #region IArticle Members

        public DataTable GetByID(decimal ID, int UserID)
        {
            return cateDao.GetByID(ID, UserID);
        }

        #endregion


        public DataTable Search(string ordercode, string deliverycode, string email, string phone, string name, string from, string to, int groupid, int userid)
        {
            return cateDao.Search(  ordercode,  deliverycode,email, phone, name, from, to, groupid, userid);
        }

        public object Insert(CM_OrderDTO dto)
        {
            return cateDao.Insert(dto);
        }

        public bool Edit(CM_OrderDTO dto)
        {
            return cateDao.Edit(dto);
        }

        public bool Delete(int id)
        {
            return cateDao.Delete(id);
        }


        internal DataTable GetDetail(decimal OrderID)
        {
            return cateDao.GetDetail(OrderID);
        }

        internal bool CheckExistsOrderCode(string code, decimal orderid)
        {
            return cateDao.CheckExistsOrderCode(code, orderid);
        }

        internal DataTable GetOrdersByDiscountID(object ID)
        {return cateDao.GetOrdersByDiscountID(ID);
        }
    }
}